package org.bilinc.gz001.hibernateUtil;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * User: Lalasianin
 * Date: 16.11.12
 * Time: 0:19
 * To change this template use File | Settings | File Templates.
 */

public class AppContextHolder {

    private static ApplicationContext appContext = loadApplicationContext();

    private static ApplicationContext loadApplicationContext() {
        return new ClassPathXmlApplicationContext("applicationContext.xml");
    }

    public static ApplicationContext getAppContext() {
        if (appContext == null) {
            appContext = loadApplicationContext();
        }
        return appContext;
    }

    public static void setAppContext(ApplicationContext appContext) {
        AppContextHolder.appContext = appContext;
    }

    public void shutdown() {
    }

}
